package top.coolrainly.module.pb.dal.mysql.theme;

import java.util.*;

import top.coolrainly.framework.common.pojo.PageResult;
import top.coolrainly.framework.mybatis.core.query.LambdaQueryWrapperX;
import top.coolrainly.framework.mybatis.core.mapper.BaseMapperX;
import top.coolrainly.module.pb.dal.dataobject.theme.ThemeDO;
import org.apache.ibatis.annotations.Mapper;
import top.coolrainly.module.pb.controller.admin.theme.vo.*;

/**
 * 党建 主题 Mapper
 *
 * @author CoolRainLy
 */
@Mapper
public interface ThemeMapper extends BaseMapperX<ThemeDO> {

    default PageResult<ThemeDO> selectPage(ThemePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ThemeDO>()
                .likeIfPresent(ThemeDO::getName, reqVO.getName())
                .eqIfPresent(ThemeDO::getIntroduce, reqVO.getIntroduce())
                .eqIfPresent(ThemeDO::getRemark, reqVO.getRemark())
                .eqIfPresent(ThemeDO::getGrid, reqVO.getGrid())
                .eqIfPresent(ThemeDO::getModelUrl, reqVO.getModelUrl())
                .betweenIfPresent(ThemeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ThemeDO::getId));
    }

}